From c9a1b736426b9ba5a96660ef3b23bb2f5100e79e Mon Sep 17 00:00:00 2001 From: David Scott Date: Wed, 22 Oct 2014 14:52:41 +0100 Subject: [PATCH] libxl: a domain can be dying but not shutdown The shutdown code is only present if the domain is shutdown. If we attempt to extract it from the flags from a dying but not shutdown domain then we get values like '255' which is not a valid LIBXL_SHUTDOWN_REASON_. We should use LIBXL_SHUTDOWN_UNKNOWN in this case. Signed-off-by: David Scott Acked-by: Rob Hoes Acked-by: Ian Campbell [ ijc -- updated comment in libxl_types.idl to match ] --- tools/libxl/libxl.c | 2 +- tools/libxl/libxl_types.idl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 18561fbe59..7e7d1dff8f 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -609,7 +609,7 @@ static void xcinfo2xlinfo(libxl_ctx *ctx, xlinfo->blocked = !!(xcinfo->flags&XEN_DOMINF_blocked); xlinfo->running = !!(xcinfo->flags&XEN_DOMINF_running); - if (xlinfo->shutdown || xlinfo->dying) + if (xlinfo->shutdown) xlinfo->shutdown_reason = (xcinfo->flags>>XEN_DOMINF_shutdownshift) & XEN_DOMINF_shutdownmask; else xlinfo->shutdown_reason = LIBXL_SHUTDOWN_REASON_UNKNOWN; diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl index ca3f72479d..f7fc6957e9 100644 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -260,7 +260,7 @@ libxl_dominfo = Struct("dominfo",[ ("shutdown", bool), ("dying", bool), - # Valid iff (shutdown||dying). + # Valid iff ->shutdown is true. # # Otherwise set to a value guaranteed not to clash with any valid # LIBXL_SHUTDOWN_REASON_* constant. -- 2.30.2